<%@ page import="java.util.*,java.sql.*,java.math.BigDecimal,java.text.SimpleDateFormat"%>
<%@ page import="pc.system.*,wstrader.*,wstrader.task.*,pc.util.*" %> 
<%

	//String uid=request.getParameter("uid");
	StringTokenizer st = new StringTokenizer(request.getParameter("uid"), "-"); 
	String uid=st.nextToken();
	String gid=st.nextToken();
	
	Users user = Trader.getUser(uid);
	
	if (user == null || !user.Authenticated()) {
		response.sendRedirect("logon.jsp");	
		return;
	}
	//wstrader.task.trade.Allocation ftask = user.trade.allocation;
	//wstrader.task.trade.allocation.Contract task = user.trade.allocation.contract;
	wstrader.task.traffic.si.Instruction task = user.traffic.si.sIns;
%>

<table width="100%" height="309" border="0" class="style2">
        

        <tr align="top" style="height:260px">
          <td width="100%" height="29" colspan="11" valign="top" class="style2" align="center"><div align="left" id=scroll1 style="BORDER:0px ; OVERFLOW: auto; WIDTH: 100%; HEIGHT: 260px;">
            <div align="justify">
              <table width="99%"  border="1" cellpadding="1" cellspacing="1" class="style2">
                
                <%
				ResultSet Rs = task.fetchPurCntUnAlcList(gid);
				int dLoop=1;
				Rs.beforeFirst();
					while (Rs.next())
					{			
			%>
                <tr id=<%=Rs.getInt("id")%> onClick="setDefault('Alc_<%=dLoop%>','Avl_ton_<%=dLoop%>')" onDblClick="dbClick(this);" bordercolor="#EEEEEE">
       			  <td width="10%" align="left" class="style2">&nbsp;<%=Rs.getInt("id")%>
       			  <input type="hidden" name="hiddenField" id="Alc_id_<%=dLoop%>" value="<%=Rs.getInt("id")%>" /></td>
              			    <td width="18%" align="left" class="style2">&nbsp;<%=Rs.getString("ref_number")%></td>
              			    <td width="18%" align="right" class="style2"><%=Utils.numberToStr(Rs.getFloat("tons"),3)%>&nbsp;</td>
              			    <td width="21%" align="right" class="style2"><%=task.getFieldValueForId("grade_master","name",Rs.getInt("grade_id"))%>&nbsp;</td>
   			      <td width="18%" align="right" class="style2"><%=Utils.numberToStr(Rs.getFloat("avltons"),2)%>
           			        <input type="hidden" name="Avl_ton_<%=dLoop%>" id="Avl_ton_<%=dLoop%>" value="<%=Utils.numberToStr(Rs.getFloat("avltons"),2)%>" />   			        
   			        &nbsp;</td>
              			    <td width="15%" align="right" class="style2"><input type="text" id="Alc_<%=dLoop%>" value="0" onchange="doOnClic_Alc();"/></td>
            	</tr>
                <%
			
						dLoop=dLoop+1;
						
					}
				if (dLoop==1)
				{
			
			%>
                <tr>
                  <td align="left">&nbsp;</td>
              			    <td align="left">&nbsp;</td>
              			    <td align="right">&nbsp;</td>
              			    <td align="right">&nbsp;</td>
              			    <td align="right">&nbsp;</td>
              			    <td align="right">&nbsp;</td>
       		    </tr>
                <%
			
				}
			
			%>			              <tr>
                  <td colspan="7" align="left"></td>
                  </tr>
              </table>
              <input type="hidden" name="sel_id" id="sel_id" />
              <input name="dRow" type="hidden" id="dRow" value="<%=dLoop%>" />
            </div>
          </div>            </td>
		  </tr>
</table>